PROJECT(CONEX-Gui)

FIND_PACKAGE(Qt4 REQUIRED)
#find xerces package
INCLUDE(${QT_USE_FILE})

#add the files to our groups and app
SOURCE_GROUP("main" ./main/*)
SOURCE_GROUP("viewmodel" ./viewmodel/*)
#seems to be a bug in cmake, can't put these in analysis\\standard folder :(
#upper detail

#QT4_WRAP_CPP
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})

QT4_WRAP_CPP(conexmain_MOCS ./main/conexmain.h)
QT4_WRAP_UI(conexmain_UIS ./main/conexmain.ui)
QT4_WRAP_CPP(conexide_MOCS ./main/conexide.h)
QT4_WRAP_UI(conexide_UIS ./main/conexide.ui)
QT4_WRAP_CPP(FindDialog_MOCS ./main/FindDialog.h)
QT4_WRAP_UI(FindDialog_UIS ./main/FindDialog.ui)
QT4_ADD_RESOURCES(CONEX-RCC_SRCS ./main/conexmain.qrc)
#QT4_WARP_UI

SET(CONEX-Gui_Files
	#for example 
	#./control/ControlSynset.cpp	
	./main/main.cc	
	./main/conexmain.cc
	./main/conexide.cc
	./main/FindDialog.cc
	./viewmodel/VocabularyTableModel.cc
#	./viewmodel/ModifiedTableModel.cc
#	./viewmodel/HistoryTableModel.cc
	${conexmain_MOCS}
	${conexmain_UIS}
	${conexide_MOCS}
	${conexide_UIS}
	${FindDialog_MOCS}
	${FindDialog_UIS}
	${CONEX-RCC_SRCS}	
)


#find our headers
file(GLOB_RECURSE HEADERS ${CONEX-Gui_SOURCE_DIR}/*.h)



#create the libraries
INCLUDE_DIRECTORIES( ${CONEX_SOURCE_DIR}/src/gui 
                     ${CONEX_SOURCE_DIR}/src/model
					 ${CONEX_SOURCE_DIR}/src/control
					 ${CONEX_SOURCE_DIR}/src/dal
					 ${CONEX_SOURCE_DIR}/src/util
					 ${CONEX_SOURCE_DIR}/src/ternary_tree)

add_executable(CONEX-Gui
	           ${CONEX-Gui_Files} 
	           ${HEADERS})

FIND_PACKAGE(XERCESC REQUIRED)

TARGET_LINK_LIBRARIES(CONEX-Gui
               optimized 
			   CONEX-Model 
               CONEX-Control
			   CONEX-Dal 
			   CONEX-Util
               ${XERCESC_LIBRARY}
			   ${QT_LIBRARIES})
			   
TARGET_LINK_LIBRARIES(CONEX-Gui
               debug
			   CONEX-Model 
               CONEX-Control
			   CONEX-Dal 
			   CONEX-Util
               ${XERCESC_LIBRARY_DEBUG}
			   ${QT_LIBRARIES_DEBUG})

#set properties on the libraries
SET_TARGET_PROPERTIES(CONEX-Gui PROPERTIES
    VERSION ${CONEX_VERSION}
    SOVERSION ${CONEX_SOVERSION}
    COMPILE_DEFINITIONS_DEBUG _DEBUG
)


if(CMAKE_SYSTEM_NAME MATCHES "Windows")
    if(DEFINED MINGW)
		SET(CMAKE_EXE_LINKER_FLAGS "-mwindows -fopenmp")
	else(DEFINED MINGW)
#	    SET_TARGET_PROPERTIES( CONEX-Gui PROPERTIES COMPILE_FLAGS "${CONEX_SOURCE_DIR}/src/dal/dal/db/otlv4.h" )
#        SET_TARGET_PROPERTIES( CONEX-Gui PROPERTIES LINK_FLAGS "odbc32.lib" )
		SET(CMAKE_CXX_FLAGS "/DGLUT_BUILDING_LIB /openmp")
		SET(CMAKE_EXE_LINKER_FLAGS "/subsystem:windows /entry:mainCRTStartup")
	endif(DEFINED MINGW)
else(CMAKE_SYSTEM_NAME MATCHES "Windows")
	SET(CMAKE_EXE_LINKER_FLAGS "-fopenmp")
endif(CMAKE_SYSTEM_NAME MATCHES "Windows")



